/**
 * 压缩数组，因为数组有空洞
 * @see https://2ality.com/2015/09/holes-arrays-es6.html
 * @see https://www.freecodecamp.org/news/sparse-and-dense-arrays-in-javascript
 */
 const condense = require('deepdash/condense');

 // 压缩数组
 const testArr1 = [1, 2, 3, 5, 6, 7, null, undefined]
 delete testArr1[0]
 console.log('testArr1 after delete: ', testArr1)
 console.log('压缩: ', condense(testArr1))

 console.log('含有Null，undefined不压缩: ', condense(testArr1))

// condenseDeep: 深度的压缩
 let obj = { arr: ['a', 'b', { c: [1, , 2, , 3] }, 'd', 'e'] };

 console.log('深度压缩original:', obj);
  delete obj.arr[1];
  delete obj.arr[3];
  console.log('深度压缩before:', obj);
  const condenseDeep = require('deepdash/condense');
  condenseDeep(obj);
  console.log('深度压缩after:', obj);
